package com.example.server.entity;

import com.alibaba.druid.sql.dialect.odps.ast.OdpsAddFileStatement;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

@Data
@Document(indexName = "citys")
public class ElasticCity {
    @Id
    private Integer id;
    @Field(analyzer = "ik_max_word", type = FieldType.Text, searchAnalyzer = "ik_max_word")
    private String name;


    public ElasticCity(Integer id, String name) {
        this.id = id;
        this.name = name;
    }

    // AdvanceBeanUtils.copyProperties使用反射newInstance()调用无参构造方法
    public ElasticCity() {
    }

    @Override
    public String toString() {
        return "ElasticCity{" +
                "id=" + id +
                ", name='" + name + '\'' +
                '}';
    }
}
